<?php

/**
 * FILE: comments.php 
 * Created on Jul 14, 2012 at 10:16:55 PM 
 * Author: Mr.Vibe 
 * Credits: www.VibeThemes.com
 * Project: WordPress 
 * License: GPLv2
 */

if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
	die ('Please do not load this page directly. Thanks!');
if ( post_password_required() ) {
	echo 'This post is password protected. Enter the password to view comments.';
	return;
}

?>

<!-- comments list -->
	<div id="comments-wrap">
	<h3 class="heading"><?php comments_number('0','1','%'); ?> COMMENTS (<?php  post_comments_feed_link('RSS Feed'); ?>)</h3>
                                                
	<?php if ( have_comments() ) : ?>
           <ol class="commentlist">
		<?php wp_list_comments('avatar_size=35'); ?>
	   </ol>
         <?php else : // this is displayed if there are no comments so far ?>
                     <?php if ($post->comment_status == 'open') : ?>
                          <p>There are no comments yet, add one below.</p>
                     <? else : ?>
                           <p>Comments are closed.</p>
                      <?php endif; ?>

         <? endif; ?>
        </div>
	<!-- ENDS comments list -->
					
                <?php if ('open' == $post->comment_status) : ?>					
					<!-- Respond -->				
			<div id="respond">
			<h3 class="heading"><?php comment_form_title( 'Leave a Comment', 'Leave a Reply to %s' ); ?></h3>
                                 <div class="cancel-comment-reply">
                                                     <?php cancel_comment_reply_link() ?>
                                  </div>
		 <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
                          <p>You must be  <a href="<?php bloginfo('url'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p>
                 <?php else : ?>
                           <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
                             <?php comment_id_fields(); ?>
		
                <?php if ( $user_ID ) : ?>
                <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>.
                <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout</a></p>
                <?php else : ?>
							<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" />
							<label for="author">Name <small>*</small></label><br/>
						
							<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" />
							<label for="email">Email <small>*</small> <span>(not published)</span></label><br/>
						
							<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" />
							<label for="url">Website</label>
						  <?php endif; ?>
							<textarea name="comment" id="comment"  tabindex="4"></textarea>
								
							<p><input name="submit" type="submit" id="submit" tabindex="5" value="Post" /></p>
							
							<?php do_action('comment_form', $post->ID); ?>	
						</form>
					</div>
 <?php 
 endif;
 endif;
 ?>
					<div class="clearfix"></div>
					<!-- ENDS Respond -->
						